package src.montecarlo;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

public class TestingIsing {

	public static void main(String[] argvs) throws IOException{
		
		Ising2D ising = new Ising2D(50,100,0,1);
		
		int trials = 1000;
		double[] data = new double[trials];
		
		FileOutputStream fos = new FileOutputStream(new File("ising.dat"));
		for(int i=0;i<trials;i++){
			ising.shakeTheSystemManyTimes(3);

			double magnetization = ising.getMagnetization();
			double energy = ising.getEnergy();
			
			fos.write((magnetization+","+energy+"\n").getBytes());
			data[i]=energy;
			
			System.out.println(i*1.0/trials);
		}
		MMCUtils helper = new MMCUtils(data);
		//helper.autoCorrelation("auto.dat");
	}
	
}
